-module(sortedlist, [Compare]).
-extends(list).

-export([new/2, tolist/0]).

new(Compare, List) ->
    L = ?BASE_MODULE:new(List),
    instance(L, Compare).

%% returns the Erlang representation of the list, which is sorted
tolist() ->
    {_, {_, List}, _} = THIS,
    lists:sort(Compare, List).